package com.example.mybatis.flex.service;

import com.example.mybatis.flex.entity.DenodoJsonView;
import com.example.mybatis.flex.entity.DenodoUserView;
import com.example.mybatis.flex.mapper.DenodoMapper;
import com.example.mybatis.flex.mapper.DenodoUserMapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class DenodoService extends ServiceImpl<DenodoMapper, DenodoJsonView> {

    @Autowired
    DenodoUserMapper userMapper;

    public List<DenodoJsonView> getDenodoView() {
        return this.list();
    }

    @Transactional
    public int saveOrUpdate(DenodoUserView dv) {
        return userMapper.insertOrUpdate(dv);
    }

    public List<DenodoUserView> getDenodoUserView() {
        return userMapper.selectAllWithRelations();
    }


}
